Add new arguments (enhancements especially when used in scripted environments)#10
Add new arguments (enhancements especially when used in scripted environments)#10cipriancraciun wants to merge 5 commits intocrigler:masterfrom
Conversation
… clear method on exit
…the command to start with a `-`
|
I cherry-picked the commit to add the The other commits feel messy to me. |
Is there something I could do to fix the other ones? Since opening this pull request I've relied heavily on the |
|
The first Should the terminal always be completely reset before attaching and should graphic attributes always be reset on exit? That might be an unexpected behavior change, for example dtach is used in environments like proxmox to wrap VM consoles where minimal processing may be desired. The git repository will exist long after github is gone, and someone should not have to look at a PR/issue on github to understand the why of a commit. https://github.blog/developer-skills/github/write-better-commits-build-better-projects/ and https://cbea.ms/git-commit/ explain why and how to write better commits and pull requests. I think there is also disagreement on what to replace dtach's assumptions with. PR #5 uses |
|
Looking at some old issues such as #14 and #15 reminded me that some programs do change the terminal state upon startup, so always completely resetting the terminal when attaching would break things for some users. These commits are doing a lot more than the "quite minor" changes described in the initial pull request comment. |
I have made three (quite minor) changes, that are most helpful in scripted scenarios, where
dtachis used behind the scenes. Namely:add support for
--argument termination marker (just like other Linux tools), which allows one to have executables starting with-; another side-effect of this patch is that in casedtachis used in a script where we can't trust the user input, now the user is not able to inject new options that are interpreted bydtach; (for example it is used likedtach -c socket -- ${@};add support for
-qoption which, like other Linux tools makesdtachexit quietly if everything is OK; basically it doesn't print anymore[EOS ...]; in conjunction with the other patches which introduce the-Roption, it makesdtachtransparent when used in scripts;add support for
-R(the symmetric argument for-r), which allows the user how the terminal is cleared when the command exits or is detached; the two options aremove(the current behavior) andnone, which just prints a new line; the second variant allows one to usedtachin a loop for short commands, and still be able to read their output without having to scroll; (one use-case is for example in a Jenkins job;)If these patches are accepted I can also provide the necessary
manupdates. (For now I have only added the embedded help documentation.)